/**
 * 路径名称
 */
import { HOME_PAGE, LOGIN_PAGE, WORKBENCH_PAGE } from "@/common/constants";

/**
 * 图片
 */
import { NIcon } from "naive-ui";
/**
 *
 */
import { Home, TrendingUp } from "@vicons/ionicons5";
/**
 *
 */
import { h, ref } from "vue";
/**
 * 首页
 */
import HomePage from "@/views/home/HomePage.vue";
/**
 * 
 */
import PictureOne from "@/assets/Home.svg";

// 先定义 authRoutes
const authRoutes = {
  path: "/home",
  name: HOME_PAGE,
  component: HomePage,
};

/**
 * 公共路由
 */
export const routes = [
  {
    path: "/",
    redirect: (to) => {
      return {
        name: LOGIN_PAGE,
      };
    },
  },
  authRoutes, // 现在可以安全使用
  {
    path: "/login",
    name: LOGIN_PAGE,
    label: "我是登录",
    component: () => import("@/views/login/LoginPage.vue"),
  },
  {
    path: "/:pathMatch(.*)*",
    redirect: (to) => {
      return {
        name: LOGIN_PAGE,
      };
    },
  },
];
/**
 *  头部按键
 */
export const menuOptions = [
  {
    path: "/workbench",
    name: WORKBENCH_PAGE,
    label: "工作台首页",
    icon: renderIcon(Home),
    component: () => import("@/views/workbench/WorkbenchPage.vue"),
  },
];



function renderIcon(icon) {
  return () => h(NIcon, null, { default: () => h(icon) });
}